package cn.edu.zafu.bigdata.Yum;

public class ArithmeticExceptionDemo {
    public static int divide(int a,int b){
        if(b==0){
            throw new ArithmeticException("除数不能为0！");
        }
        return a/b;
    }

    public static void main(String[] args) {
        try{
            int c=divide(1,0);
            System.out.println("结果是："+c);
        }catch(ArithmeticException err){
            System.out.println("报错："+err.getMessage());
        }
    }
}
